<!DOCTYPE html>
{% load static %}
<html lang="en">
    
<!-- Mirrored from coderthemes.com/velonic_3.0/admin_3/login.html by HTTrack Website Copier/3.x [XR&CO'2014], Sun, 29 May 2016 14:53:39 GMT -->
<head>
        <meta charset="utf-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <meta name="description" content="">
        <meta name="author" content="">

        <link rel="shortcut icon" href="{% static 'img/favicon_1.ico' %}">

        <title>自动化运维平台</title>

        <!-- Bootstrap core CSS -->
        <link href="{% static 'css/bootstrap.min.css' %}" rel="stylesheet">
        <link href="{% static 'css/bootstrap-reset.css' %}" rel="stylesheet">

        <!--Animation css-->
        <link href="{% static 'css/animate.css' %}" rel="stylesheet">
        <!--Icon-fonts css-->
        <link href="{% static 'assets/font-awesome/css/font-awesome.css' %}" rel="stylesheet" />
        <link href="{% static 'assets/ionicon/css/ionicons.min.css' %}" rel="stylesheet" />
        <!--Morris Chart CSS -->
        <link rel="stylesheet" href="{% static 'assets/morris/morris.css' %}">
        <!-- Custom styles for this template -->
        <link href="{% static 'css/style.css' %}" rel="stylesheet">
        <link href="{% static 'css/helper.css' %}" rel="stylesheet">
    </head>

    <body>
        <div class="wrapper-page animated fadeInDown">
            {% if form %}
                {{ form.errors }}
            {% endif %}

            {% if msg %}
                <p style="color:red"> {{msg}} </p>
            {% endif %}
            <div class="panel panel-color panel-success">
                <div class="panel-heading"> 
                   <h3 class="text-center m-t-10"> 登录 <strong>自动化运维平台</strong> </h3>
                </div> 

                <form class="form-horizontal m-t-40" action="" method="post">
                    {% csrf_token %}
                    <div class="form-group ">
                        <div class="col-xs-12">
                            <input class="form-control" type="text" name="username" placeholder="用户名">
                        </div>
                    </div>
                    <div class="form-group ">
                        
                        <div class="col-xs-12">
                            <input class="form-control" type="password" name="password" placeholder="密码">
                        </div>
                    </div>
                    
                    <div class="form-group text-right">
                        <div class="col-xs-12">
                            <button class="btn btn-success w-md" type="button">登录</button>
                        </div>
                    </div>
                </form>

            </div>
        </div>

    


        <!-- js placed at the end of the document so the pages load faster -->
        <script src="{% static 'js/jquery.js' %}"></script>
        <script src="{% static 'js/bootstrap.min.js' %}"></script>
        <script src="{% static 'js/pace.min.js' %}"></script>
        <script src="{% static 'js/wow.min.js' %}"></script>
        <script src="{% static 'js/jquery.nicescroll.js' %}" type="text/javascript"></script>
            
        <!--common script for all pages-->
        <script src="{% static 'js/jquery.app.js' %}"></script>
        <script>
            $('button').click(function () {
                 var username = $('#username').val()
                 var password = $('#password').val()
                $.ajax({
                    type: "POST",
                    url: "/",
                    data: {username:username, password:password},
                    dataType: "json",
                    success: function(data){
                        status = data.code
                        console.log(status)
                        if (status == 0){
                            console.log(data)
                            location.href = data['next_url']

                        } else {
                            console.log(data)
                            $('#errors').html(data['errmsg'])
                        }
                    },
                    error: function(){
                        alert("服务器内部错误")
                         $('#errors').html('服务器内部错误')
                    },

                })
            })
        </script>
    </body>

<!-- Mirrored from coderthemes.com/velonic_3.0/admin_3/login.html by HTTrack Website Copier/3.x [XR&CO'2014], Sun, 29 May 2016 14:53:39 GMT -->
</html>
